[여름방학 2주차] - 허원일#59
Closed
wonza-hub wants to merge 3 commits intoCBNU-Nnet:mainfrom
wonza-hub:2주차/허원일
Hidden character warning
The head ref may contain hidden characters: "2\uc8fc\ucc28/\ud5c8\uc6d0\uc77c"
Closed
Conversation
alirz-pixel
reviewed
Jul 11, 2022
허원일/11478 서로 다른 부분 문자열의 개수.py
Outdated
Collaborator
There was a problem hiding this comment.
python 쓰시는 분들은 set이랑 slicing 을 많이 사용하시는군요!
alirz-pixel
reviewed
Jul 11, 2022
허원일/1225 이상한 곱셈.py
Outdated
Collaborator
There was a problem hiding this comment.
오 함수별로 기능을 나눠둔게, 가독성이 좋게 느껴집니다
추가 견해
- 작성하신
slice 함수를 python 내장 함수를 이용해서 구현 가능합니다
- [여름방학 2주차] - 김예경 #58 예경님이 작성하신 코드를 보면서 저도 배웠습니다 ㅎㅎ
slice 함수대신slice_sum이라는 함수를 만들어서 각 자리수의 합을 리턴해주는 함수를 만드는 것도 나쁘지 않았을 거 같네요!
Collaborator
Author
There was a problem hiding this comment.
저도 다른 스터디원들 풀이보고 아차 싶었는데 정확히 짚어 주셨네요ㅎㅎ 파이썬 기본문법 참고서 다시 펼쳐봐야겠씁니다..
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
😀 PR을 올리기 전 준비
🤩 이번주 문제
🧑💻 어떻게 푸셨나요?
11478 서로 다른 부분 문자열의 개수
이중 for문으로 문자열의 모든 부분문자열의 경우를 조사한다
파이썬의 중복되지 않는 원소를 담는 집합자료형인 세트를 활용한다
1225 이상한 곱셈(시간초과 -> 인터넷 풀이 참고)
1×3 + 1×4 + 2×3 + 2×4 + 1×3 + 1×4 = 28
(1+2+1)x(3+4) 두 다항식을 곱한 형태로 표현 가능하다
lv.1 문자열 압축
주석참고
✍️ 질문을 적어주세요.
x
📖 참고 사항
중복값을 제외하고 값을 저장할때 집합자료형
set()를 쓸 수 있음list(map(int,x))사용시 문자열 x의 문자 하나단위로 쪼개져서 list에 저장됨최댓값 또는 최솟값을 구하는 과정이 있는 문제에서 초기값을 무한대나, 매우 작은 음수 등 초기값을 설정한 후 그 값과 비교하여 갱신하거나 그대로 유지함
prev와 cur를 활용하여 값을 갱신하는 경우 보통 계산식에서 prev를 사용하여 값을 나타냄